<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-model组件</title>
    <script src="scripts/jquery-3.4.1.min.js"></script>
    <script src="scripts/vue.js"></script>
</head>
<body>
    <div id="app">        
        <xlb-input :username="username" @input="username=$event"></xlb-input>
        <h3>{{username}}</h3>
    </div>
    <script>
        Vue.component('xlb-input',{
            props:['username'],
            //         <input type="text" @input="$emit('child-input',$event.target.value)" :value="username" id="">
            templdate:`<input type="text" @input="$emit('input',$event.target.value)" :value="username" id="">`
        })
        let app=new Vue({
            el:"",
            data:{
                username:''
            },
            methods:{
                changeEvent:function(data){
                    console.log(this)
                    this.username=data;
                }
            }
        })
    </script>
</body>
</html>